package com.webapi.apis;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.webapi.core.model.dto.OrderDto;
import com.webapi.core.model.persist.Order;

@Controller
@RequestMapping("/order")
public class OrderAct extends BaseAct {
    
    private final Log logger = LogFactory.getLog(getClass());
    
    @RequestMapping(value = "/test", method = RequestMethod.POST)
    public @ResponseBody String test(HttpServletRequest request) {
        return "test";
    }
    
    
    @RequestMapping(value = "/view", method = RequestMethod.POST)
    public @ResponseBody List<OrderDto> view(@RequestBody List<String> cds) {
        logger.info("cds=" + cds.toString());
        List<Order> orders = facadeService.findOrders(cds);
        return OrderDto.valueOf(orders);
    }
}
